package threading;

public class Demo21 {

    public static void main(String[] args) {
        Object object = new Object();
        Thread a = new Thread(()-> {
           synchronized (object) {
               try {
                   object.wait();
               } catch (InterruptedException e) {
                   e.printStackTrace();
               }
               System.out.println("a");
           }
        });

        Thread b = new Thread(()-> {
            synchronized (object) {
                try {
                    object.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("b");
            }
        });

        Thread c = new Thread(()-> {
            synchronized (object) {
                System.out.println("c");
                object.notifyAll();

            }
        });
        a.start();
        b.start();
        c.start();
    }
}
